A rectangle has both a width and a height, and an area and perimeter formed by those two characteristics.

$$Area = w \cdot h$$

$$Perimeter = 2w + 2h$$

A rectangle can be represented by just the diagonal connecting the two opposite corners.

This diagonal has a length that is related to the width and height with the Pythagorean theorem:

$$d^2 = w^2 + h^2$$

$$d = \sqrt{w^2 + h^2}$$

One can resize the rectangle - adjusting both the width and height - while keeping this diagonal length constant. Imagine dragging your mouse cursor in a circle after having created a rectangle with it.

Area = 0, Perimeter = 0, w = 0, h = 0

While the diagonal length remains the same, the width and height vary - and so do the perimeter and area.