System, method and configurations providing compact phase-matched and waveguided nonlinear optics in atomically layered semiconductors