This is a self-answered question.
Let $v_i,w_i \in \mathbb{S}^n \subseteq \mathbb{R}^{n+1}$, $i=1,\dots,k$ be points on the sphere. Suppose that the Euclidean distances $\|v_i-v_j\|=\|w_i-w_j\|$ for all $i<j$.
How to prove that there exist an isometry $Q \in \text{O}(n)$ such that $Qv_i=w_i$?
This question is similar to this one, but here I do not assume independence, the number of points is arbitrary, and they lie on a sphere, so the mapping isometry is actually linear, not just affine.
Alternative solutions are welcome. In particular, I think that it's possible to reduce this question to the mentioned question above in a neat way.
A matrix-theoretic proof is probably easier in this case, although it is conceptually more opaque. Given two real (tall, square or fat) matrices $V$ and $W$ of the same size, if $V^TV=W^TW$, we want to show that $QV=W$ for some orthogonal matrix $Q$.
Clearly $V$ and $W$ have the same rank $r$. Suppose $r>0$. By singular value decomposition, we can construct two rank factorisations $V=U_1R_1^T$ and $W=U_2R_2^T$ such that each $U_i$ has $r$ orthonormal columns and each $R_i$ has full column rank. From $V^TV=W^TW$ we obtain $R_1R_1^T=R_2R_2^T$. Therefore $R_1$ and $R_2$ have the same column space. Hence $R_1=R_2X$ for some invertible matrix $X$ and $R_2XX^TR_2^T=R_2R_2^T$. Since $R_2$ has full column rank, it has a left inverse. Therefore $XX^T=I$, i.e., $X$ is orthogonal. Pick any orthogonal matrix $Q$ such that $Q(U_1X^T)=U_2$. Then $$ QV=QU_1R_1^T=QU_1(R_2X)^T=Q(U_1X^T)R_2^T=U_2R_2^T=W. $$