Connecting curvature to the 'failure of squares to close' In one of the Feynman lectures, Feynman describes curvature as the failure of a square to close. By switching to spacetime, Feynman then claims that the curvature of spacetime is reflected by the desynchronization of clocks at different points, which form a square in spacetime. He says:

What happens to the bug on the sphere when he tries to make a “square”? If he [lays out four straight lines of equal length—as measured with his rulers—joined by right angles...] it doesn’t work out to a closed figure at all. Get a sphere and try it.
We define a curved space to be a space in which the geometry is not what we expect for a plane. The geometry of the bugs on the sphere or on the hot plate is the geometry of a curved space. The rules of Euclidean geometry fail. And it isn’t necessary to be able to lift yourself out of the plane in order to find out that the world that you live in is curved. It isn’t necessary to circumnavigate the globe in order to find out that it is a ball. You can find out that you live on a ball by laying out a square.

However, I'm having trouble converting this into a formal statement. I assume the sides of the square are defined by moving a fixed proper length along a geodesic. However, I can't see how this directly connects to the Riemann tensor, because it measures the effect of parallel transport along a closed loop, while the square description is about the failure of a loop to close. How are these notions related?
 A: Let's start at some point $x^\mu_0$ and consider two unit vectors $a^\mu$ and $b^\mu$. First we take geodesic (which we will parametrize by parameter $\tau$) starting with $\frac{dx^\mu}{d\tau}\Big|_{\tau=0}=a^\mu$. Then for $\tau=L$ the new coordinate becomes,
\begin{equation}
x^\mu_a\simeq x^\mu_0+L a^\mu +\frac{L^2}{2}\frac{d}{d\tau} a^\mu+\frac{L^3}{6}\frac{d^2}{d\tau^2} a^\mu
\end{equation}
where $\frac{d}{d\tau} a^\mu$ can be obtained from,
\begin{equation}
\nabla_{x(\tau)} a^\mu=0\quad\Rightarrow \quad \frac{d}{d\tau} a^\mu=-a^\alpha {\Gamma_\alpha}^\mu_\beta a^\beta
\end{equation}
and the second derivative is obtained using the formula for the first one and,
\begin{equation}
\frac{d}{d\tau} {\Gamma_\alpha}^\mu_\beta=a^\rho\partial_\rho{\Gamma_\alpha}^\mu_\beta
\end{equation}
Then we make similar shift along $b_\tau^\mu$ with parameter $s$,
\begin{equation}
x^\mu_{ab}\simeq x^\mu_a+L b_\tau^\mu +\frac{L^2}{2}\Big[\frac{d}{ds}\Big]_\tau b_\tau^\mu+\frac{L^3}{6}\Big[\frac{d^2}{ds^2}\Big]_\tau b_\tau^\mu
\end{equation}
where $b_\tau^\mu$ is obtained by parallel transport of $b^\mu$ along the geodesic generated by $a^\mu$,
\begin{equation}b_\tau^\mu\simeq b^\mu +L\frac{d}{d\tau} b^\mu+\frac{L^2}{2}\frac{d^2}{d\tau^2} b^\mu+O(L^3)
\end{equation}
The velocities then are,
\begin{equation}
\frac{d}{d\tau} b^\mu=-a^\alpha {\Gamma_\alpha}^\mu_\beta b^\beta,\quad \frac{d}{ds} b^\mu=-b^\alpha {\Gamma_\alpha}^\mu_\beta b^\beta,
\end{equation}
However you should also take into account that on the shifted geodesic,
\begin{equation}
\Big[\frac{d}{ds}\Big]_\tau b_\tau^\mu=-b_\tau^\alpha {\Gamma_\alpha}^\mu_\beta b_\tau^\beta\simeq \frac{d}{ds} b^\mu-L\left[\Big(\frac{d}{d\tau}b^\alpha\Big){\Gamma_\alpha}^\mu_\beta b^\beta+b^\alpha{\Gamma_\alpha}^\mu_\beta \Big(\frac{d}{d\tau}b^\beta\Big)+b^\alpha b^\beta a^\rho\partial\rho{\Gamma_\alpha}^\mu_\beta\right]
\end{equation}
If we change the order of those shifts the resulting coordinate will be different. The leading order of the difference will be given by,
\begin{equation}
x^\mu_{ab}-x^\mu_{ba}\simeq L^2\Big[\frac{d}{d\tau} b^\mu-\frac{d}{ds} a^\mu\Big]=L^2 a^\alpha b^\beta\Big({\Gamma_\beta}^\mu_\alpha-{\Gamma_\alpha}^\mu_\beta\Big)
\end{equation}
I.e. it's solely depends on the torsion. Let's assume then that the connection is symmetric ${\Gamma_\alpha}^\mu_\beta={\Gamma_\beta}^\mu_\alpha$. Then the next order dominates and using the equations above one gets,
\begin{equation}
x^\mu_{ab}-x^\mu_{ba}\simeq \frac{L^3}{2}\Big(a^\rho a^\lambda b^\alpha {R^\mu}_{\lambda\alpha\rho}-b^\rho b^\lambda a^\alpha {R^\mu}_{\lambda\alpha\rho}\Big)
\end{equation}
Note that this identity uses the fact that the connection is symmetric and there may also be some extra term in case of nonzero torsion.
