Mask error enhancement factor (MEEF) depends on the two groups of factors. The first group is process-related, and includes parameters such as illumination settings and exposure dose. The second group is mask-related and includes feature sizes, feature shapes, and proximity interactions between features. Factors from the second group have not been studied to the same depth as factors of the first group. Only simple shapes like dense lines, isolated lines, and contact holes, each with only one degree of the distortion freedom, have been addressed by the traditional MEEF theory. We present here a comprehensive MEEF theory for arbitrary 2D mask shapes, with multiple degrees of the distortion freedom. This theory provides a rigorous formal framework for studying impact of the complex mask errors. We introduce mask error enhancement matrix (MEEM) to capture self-and cross-enhancement effects when neighboring mask distortions collectively contribute into the wafer errors. The norm of this matrix is called a generalized MEEF (G-MEEF), an important characteristic of the pattern transfer process. The Singular Value Decomposition of MEEM naturally groups edges of the mask shapes into the proximity-related sets, each with a distinct G-MEEF value. Ranking mask areas by this value helps to identify difficult-to-print regions and to design MEEF-sensitive test patterns. An application ofmatrix MEEF theory is shown to be iterative feedback techniques for model-based OPC.