We analyze the classical and quantum vacua of 2d $\mathcal{N}=(8,8)$supersymmetric Yang-Mills theory with $SU(N)$ and $U(N)$ gauge group,describing the worldvolume interactions of $N$ parallel D1-branes with flattransverse directions $\mathbb{R}^8$. We claim that the IR limit of the $SU(N)$theory in the superselection sector labeled $M \pmod{N}$ --- identified withthe internal dynamics of $(M,N)$-string bound states of Type IIB string theory--- is described by the symmetric orbifold $\mathcal{N}=(8,8)$ sigma model into$(\mathbb{R}^8)^{D-1}/\mathbb{S}_D$ when $D=\gcd(M,N)>1$, and by a singlemassive vacuum when $D=1$, generalizing the conjectures of E. Witten andothers. The full worldvolume theory of the D1-branes is the $U(N)$ theory withan additional $U(1)$ 2-form gauge field $B$ coming from the string theoryKalb-Ramond field. This $U(N)+B$ theory has generalized field configurations,labeled by the $\mathbb{Z}$-valued generalized electric flux and an independent$\mathbb{Z}_N$-valued 't Hooft flux. We argue that in the quantum mechanicaltheory, the $(M,N)$-string sector with $M$ units of electric flux has a$\mathbb{Z}_N$-valued discrete $\theta$ angle specified by $M \pmod{N}$ dual tothe 't Hooft flux. Adding the brane center-of-mass degrees of freedom to the$SU(N)$ theory, we claim that the IR limit of the $U(N) + B$ theory in thesector with $M$ bound F-strings is described by the $\mathcal{N}=(8,8)$ sigmamodel into ${\rm Sym}^{D} ( \mathbb{R}^8)$. We provide strong evidence forthese claims by computing an $\mathcal{N}=(8,8)$ analog of the elliptic genusof the UV gauge theories and of their conjectured IR limit sigma models, andshowing they agree. Agreement is established by noting that the elliptic generaare modular-invariant Abelian (multi-periodic and meromorphic) functions, whichturns out to be very restrictive.