Let us denote the sides of the rectangle containing vertex A as a and b (Fig. 21). Then the sides of the rectangle containing vertex B are equal to a and 2019−b. The equality of the area of the first rectangle and perimeter of the second yields:
ab=2⋅(a+2019−b)⇒ab−2a+2b=4038⇒(a+2)(b−2)=4034=2017⋅2.
Since, on the left-hand side, one of the multipliers is greater than 2, and 2017 is prime, the only solution is: a+2=2017 and b−2=2. Hence, a=2015 and b=4. Clearly, the smallest rectangle of the four would be the square with the area 4⋅4=16.