First-principles theory of the EPR g tensor in solids: defects in quartz.