How would i make a Cube rotate 90' degrees around the pivot point when i press a key?

How would i make a Cube rotate 90’ degrees around the pivot point when i press a key?

For example pressing (W to make it rotate Up, S to rotate Down, D to rotate around Left, and A to rotate around Right)