We generalize the classical theory of periodic continued fractions (PCFs) over ${mathbf Z}$ to rings ${mathcal O}$ of $S$-integers in a number field. Let ${mathcal B}={beta, {beta^*}}$ be the multi-set of roots of a quadratic polynomial in ${mathcal O}[x]$. We show that PCFs $P=[b_1,ldots,b_N,bar{a_1ldots ,a_k}]$ of type $(N,k)$ potentially converging to a limit in ${mathcal B}$ are given by ${mathcal O}$-points on an affine variety $V:=V({mathcal B})_{N,k}$ generically of dimension $N+k-2$. We give the equations of $V$ in terms of the continuant polynomials of Wallis and Euler. The integral points $V({mathcal O})$ are related to writing matrices in $textrm{SL}_2({mathcal O})$ as products of elementary matrices. We give an algorithm to determine if a PCF converges and, if so, to compute its limit. Our standard example generalizes the PCF $sqrt{2}=[1,bar{2}]$ to the ${mathbf Z}_2$-extension of ${mathbf Q}$: $F_n={mathbf Q}(alpha_n)$, $alpha_{n}:=2cos(2pi/2^{n+2})$, with integers ${mathcal O}_n={mathbf Z}[alpha_n]$. We want to find the PCFs of $alpha_{n+1}$ over ${mathcal O}_{n}$ of type $(N,k)$ by finding the ${mathcal O}_{n}$-points on $V({mathcal B}_{n+1})_{N,k}$ for ${mathcal B}_{n+1}:={alpha_{n+1}, -alpha_{n+1}}$. There are three types $(N,k)=(0,3), (1,2), (2,1)$ such that the associated PCF variety $V({mathcal B})_{N,k}$ is a curve; we analyze these curves. For generic ${mathcal B}$, Siegels theorem implies that each of these three $V({mathcal B})_{N,k}({mathcal O})$ is finite. We find all the ${mathcal O}_n$-points on these PCF curves $V({mathcal B}_{n+1})_{N,k}$ for $n=0,1$. When $n=1$ we make extensive use of Skolems $p$-adic method for $p=2$, including its application to Ljunggrens equation $x^2 + 1 =2y^4$.