It is sufficient to consider the two cases (since others are repetetive): without loss of generality, take two arbitrary points on two sides such that $0\le x\le y\le a$:
^2}\le \sqrt{a^2+a^2}=d,$$because $y-x$ is maximum, when $y=a$ and $x=0$.