Rotating Image to any degree with transparent background

The following code will rotate an image to any given degree and if you use png image then the background color can be transparent. So, you can use that rotated image upon any image or color.