The fields guided by planar gratings embedded in dielectric layers are amenable to exact analytical solutions if the grating profile is rectangular. Such a solution reveals that power transfer in grating-assisted couplers is optimized if the couplers are designed to operate at a point that does not necessarily satisfy phase-matching conditions.