A:[-5,0]$ B:[0,0]$ C:[0,7]$ D:[-5,7]$

A1:[3,-3]$ B1:[7,-4]$ C1:[5,3]$ D1:[4,4]$

wxplot2d([[discrete,[A,B,C,D,A]],[discrete,[A1,B1,C1,D1,A1]]],[x,-10,10],[y,-10,10])$

M:matrix([a11,a12,a13],[a21,a22,a23],[a31,a32,a33]);

mP:matrix([A[1],B[1],C[1],D[1]],[A[2],B[2],C[2],D[2]],[1,1,1,1]);

mP1:matrix([i*A1[1],j*B1[1],k*C1[1],l*D1[1]],[i*A1[2],j*B1[2],k*C1[2],l*D1[2]],[i,j,k,l]);

E:M.mP-mP1;

Sol1:solve([E[1,1],E[1,2],E[1,3],E[1,4],E[2,1],E[2,2],E[2,3],E[2,4],E[3,1],E[3,2],E[3,3],E[3,4]],[a11,a12,a13,a21,a22,a23,a31,a32,a33,i,j,k]);

Sol2:subst([l=1],Sol1[1]);

Mh:subst(Sol2,M);

Ph:Mh.mP;

Ah:[Ph[1,1]/Ph[3,1],Ph[2,1]/Ph[3,1]]; Bh:[Ph[1,2]/Ph[3,2],Ph[2,2]/Ph[3,2]]; Ch:[Ph[1,3]/Ph[3,3],Ph[2,3]/Ph[3,3]]; Dh:[Ph[1,4]/Ph[3,4],Ph[2,4]/Ph[3,4]];

A0:[-4,0]$ B0:[-1,0]$ C0:[-1,6]$ D0:[-4,6]$

wxplot2d([[discrete,[A,B,C,D,A]],[discrete,[A0,B0,C0,D0,A0]],[discrete,[A1,B1,C1,D1,A1]]],[x,-10,10],[y,-10,10])$

mP0:matrix([A0[1],B0[1],C0[1],D0[1]],[A0[2],B0[2],C0[2],D0[2]],[1,1,1,1]);

P0h:Mh.mP0;

A0h:[P0h[1,1]/P0h[3,1],P0h[2,1]/P0h[3,1]]; B0h:[P0h[1,2]/P0h[3,2],P0h[2,2]/P0h[3,2]]; C0h:[P0h[1,3]/P0h[3,3],P0h[2,3]/P0h[3,3]]; D0h:[P0h[1,4]/P0h[3,4],P0h[2,4]/P0h[3,4]];

wxplot2d([[discrete,[A,B,C,D,A]],[discrete,[A0,B0,C0,D0,A0]],[discrete,[A1,B1,C1,D1,A1]],[discrete,[Ah,Bh,Ch,Dh,Ah]],[discrete,[A0h,B0h,C0h,D0h,A0h]]],[x,-10,10],[y,-10,10])$