Rotating a cube on its edge

Can anyone give me some pointers on how to make a cube rotate on an arbitrary edge?

The kind of thing I’m after is something the player presses right; the cube rolls over to the right on the lower-right edge. Player presses down and the cube rolls towards the player on the lower-front edge.

Sorry for the poor explanation.

Edit: use the search, Like

For anyone else: search for “cube rotate edge” and the answer is there.