This can be easily done using HandBrake. Simply add the following option in the tab VIDEO in the EXTRA OPTIONS box:

, --rotate=n

Take note that the comma and the space following it are required.

n can take one of these values:
1 = x flip
2 = y flip
3 = 180 degrees rotate (DEFAULT)
4 = 90 degrees rotate (clockwise)
5 = 90 degrees rotate + y flip
6 = 270 degrees rotate + y flip
7 = 270 degrees rotate