  We construct an anomaly-preserving compactification of 4d gauge theories,
including $SU(N)$ Yang-Mills theory, $\mathcal{N}=1$ supersymmetric Yang-Mills
theory, and QCD, down to 2d by turning on 't Hooft flux through $T^2$. It
provides a new framework to analytically calculate nonperturbative properties
such as confinement, chiral symmetry breaking, and multi-branch structure of
vacua. We give the semiclassical description of these phenomena based on the
center vortex and show that it enjoys the same anomaly matching condition with
the original $4$d gauge theory. We conjecture that the weak-coupling vacuum
structure on small $T^2 \times \mathbb{R}^2$ is adiabatically connected to the
strong-coupling regime on $\mathbb{R}^4$ without any phase transitions. In QCD
with fundamental quarks as well, we can turn on 't Hooft flux either by
activating $SU(N_f)_{\mathrm{V}}$ symmetry twist for $N_f=N$ flavors or by
introducing a magnetic flux of baryon number $U(1)_{\mathrm{B}}$ for arbitrary
$N_f$ flavors. In both cases, the weak-coupling center-vortex theory gives the
prediction consistent with chiral Lagrangian of $4$d QCD.
