Sums of squares and orthogonal integral vectors