The angle in imagerotate() is the number of degrees to rotate the image anti-clockwise, but while it may seem natural to use '-90' to turn an image 90 degrees clockwise, the end result may appear on a slight angle, and may cause the rotated image to appear slightly blurred with a background or border. Excessively large angles may also present sampling issues.
The easiest way to prevent these, is to ensure all angles are between 0 and 360.
<?php
while ( $angle < 0 ) { $angle += 360; }
while ( $angle >= 360 ) { $angle -= 360; }
$rotated = imagerotate( $image, $angle, $color );
?>