Player Snap to faces

I have a cube, and need to snap it to the map faces while moving.
I’ll post a image to explain it better: