New method for measuring beam profiles using a parametric X-ray pinhole camera