I\'m trying to rotate a bitmap 90 degrees using the following function. The problem with it is that it cuts off part of the image when the height and width are not equal.>
The bug is in your first call to TranslateTransform:
g.TranslateTransform((float)b.Width / 2, (float)b.Height / 2);
This transform needs to be in the coordinate space of returnBitmap rather than b, so this should be:
g.TranslateTransform((float)b.Height / 2, (float)b.Width / 2);
or equivalently
g.TranslateTransform((float)returnBitmap.Width / 2, (float)returnBitmap.Height / 2);
Your second TranslateTransform is correct, because it will be applied before the rotation.
However you're probably better off with the simpler RotateFlip method, as Rubens Farias suggested.