Wow, surprised the optos on the inputs are fast enough to pass those frequencies. The datasheet specifies 200kHz max ie max pulse width of 2us or so. 4MHz infers pulse widths of 100ns or so.
EDIT - actually 500kHz. I need to go to Barnard Castle.