  Using a mix of numerical and analytic methods, we show that recent NMR
$^{17}$O measurements provide detailed information about the structure of the
charge-density wave (CDW) phase in underdoped YBa$_2$Cu$_3$O$_{6+x}$. We
perform Bogoliubov-de Gennes (BdG) calculations of both the local density of
states and the orbitally resolved charge density, which are closely related to
the magnetic and electric quadrupole contributions to the NMR spectrum, using a
microscopic model that was shown previously to agree closely with x-ray
experiments. The BdG results reproduce qualitative features of the experimental
spectrum extremely well. These results are interpreted in terms of a generic
"hotspot" model that allows one to trace the origins of the NMR lineshapes. We
find that four quantities---the orbital character of the Fermi surface at the
hotspots, the Fermi surface curvature at the hotspots, the CDW correlation
length, and the magnitude of the subdominant CDW component---are key in
determining the lineshapes.
