Something wrong is happening when running the following codes:
exec("D:/magick/convert $foto -distort Perspective \"0,0,$ax,$ay 0,$minheight,$bx,$by $minwidth,0,$cx,$cy $minwidth,$minheight,$dx,$nem \" testa2.jpg");
------------------------------
$controlPoints = array(0,0,$ax,$ay, 0,$minheight,$bx,$by, $minwidth,0,$cx,$cy, $minwidth,$minheight,$dx,$nem);
$im = new Imagick($foto);
$im->setImageMatte(true);
$im->distortImage(Imagick::DISTORTION_PERSPECTIVEPROJECTION, $controlPoints, true);
$im->writeImage("testa.jpg");
$im->destroy();
I thing that the result should be the same, but it isn't.
Take a look.
ImageMagick

Imagick Result

What is wrong with my code?