Patterning Liquid-Crystal Alignment for Ultrathin Flat Optics