For any compact connected one-dimensional submanifold $K\subset \mathbb R^{2\times 2}$ which has no rank-one connection and is elliptic, we prove the quantitative rigidity estimate \[ \inf_{M\in K}\int_{B_{1/2}}| Du -M |^2\,dx \leq C \int_{B_1} \mathrm{dist}^2(Du, K)\, dx, \qquad\forall u\in H^1(B_1;\mathbb R^2). \] This is an optimal generalization, for compact connected submanifolds of $\mathbb R^{2\times 2}$, of the celebrated quantitative rigidity estimate of Friesecke, James and Müller for ...