Use the scalar product of the diagonals. As the quadrilateral is flexed the diagonals change but the lengths of the sides are constant. All the vectors change but the the squares of the vectors of the sides (representing the lengths) remain constant. To preserve symmetry and obtain this scalar product in the form required, write

$$2{\bf d}_1={\bf a}_1-{\bf a}_2-{\bf a}_3+{\bf a}_4, \quad 2{\bf d}_2=-{\bf a}_1-{\bf a}_2+{\bf a}_3+{\bf a}_4.$$