Try and calculate a rotation which is similar to the original placement rotation (but snapped to the wall) So for example: a box rotated perpendicular to the wall should stay perpendicular even once snapped