Characterization and error analysis of an N×N unfolding procedure applied to filtered, photoelectric x-ray detector arrays. I. Formulation and testing