Answer:
(X2-X1)*2+(Y2-Y1)*2
Explanation:
If each point is a vertex of the rectangle, then you'll have the 4 corners:
Left-lower corner: (X1,Y1)
Left-higher corner: (X1,Y2)
Right-lower corner: (X2,Y1)
Right-higher corner: (X2,Y2)
The diference beetween the X and Y values is equal to each side of the rectangle; doing the double sum of each side (X2 - X1) and (Y2 - Y1) it's equal to the perimeter