Clean up movement boundary checking.

Reusing rotation logic.