private function drawPoiRectangle($poi, $color, $borderSize, $imageWidth, $imageHeight)
{
$rect = new ImagickDraw();
$rect->setStrokeColor($color);
$rect->setFillColor($color);
$rect->setStrokeAntialias(false);
$x1 = max(0, $poi['x'] - $borderSize);
$x2 = min($imageWidth, $poi['x'] + $poi['width'] + $borderSize);
// Left
$rect->rectangle($x1, $poi['y'], $poi['x'], $poi['y'] + $poi['height']);
// Right
$rect->rectangle($poi['x'] + $poi['width'], $poi['y'], $x2, $poi['y'] + $poi['height']);
// Top
$rect->rectangle($x1, max(0, $poi['y'] - $borderSize), $x2, $poi['y']);
// Bottom
$rect->rectangle($x1, $poi['y'] + $poi['height'], $x2, min($imageHeight, $poi['y'] + $poi['height'] + $borderSize));
// Draw the rectangle
$this->imagick->drawImage($rect);
}