Slowing down rotary encoder using interrupts

You neet to declair any variable used in AB ISR as volatile.
Simply divide rotate by 4 before you use it.