Clamp out-of-bounds movements.