How to round rotation angle up or down?

Are you saying that you want the box to move just along X, or just along Y, but not both at the same time? Like pushing a square block along a grid (seen in games like tomb raider/zelda etc).