Rotation Counter

Rotation counter code (untested), without any sort of direction
determining factor