throws IOException {
Rectangle originalPaintArea = new Rectangle(values.map.getMapSize());
MapBounds adjustedBounds =
CreateMapProcessor.adjustBoundsToScaleAndMapSize(values.map, values.map.getDpi(), originalPaintArea, originalBounds);
ReferencedEnvelope originalEnvelope =
adjustedBounds.toReferencedEnvelope(originalPaintArea, values.map.getDpi());
Geometry mapExtent = JTS.toGeometry(originalEnvelope);
if (values.map.getRotation() != 0.0) {
mapExtent = rotateExtent(mapExtent, values.map.getRotation(), originalEnvelope);
}