Geometric formalism for constructing arbitrary single-qubit dynamically corrected gates