merge from demotivator/PDFrenderer 
Fixed handling of rotation for 90/270