Some transformations including Imagick ::rotateImage() may change "image page" -- working area inside the image you work on.
Be careful with future modifications afterwards because the image page would be different from new sizes of the image.
For example, if you do Imagic::cropImage() after rotation, you need to set image page properly, otherwise your crop would be performed relating to wrong coordinates (depending on rotation angle, resulting image size may vary).
<?php
$Image = new Imagick($sourceImagePath);
$transparent = '#00000000';
$Image->rotateImage(new \ImagickPixel(), 45); $Image->setImagePage($Image->getImageWidth(), $Image->getImageHeight(), 0, 0);
$Image->cropImage($crop_w, $crop_h, $crop_x, $crop_y);
?>