The Wide Field Camera 3 (WFC3) on Hubble Space Telescope (HST) is currently one of the most widely used instruments for observing exoplanetary atmospheres, especially with the use of the spatial scanning technique. An increasing number of exoplanets have been studied using this technique as it enables the observation of bright targets without saturating the sensitive detectors. In this work we present a new pipeline for analyzing the data obtained with the spatial scanning technique, starting from the raw data provided by the instrument. In addition to commonly used correction techniques, we take into account the geometric distortions of the instrument, whose impact may become important when combined to the scanning process. Our approach can improve the photometric precision for existing data and also push further the limits of the spatial scanning technique, as it allows the analysis of even longer spatial scans. As an application of our method and pipeline, we present the results from a reanalysis of the spatially scanned transit spectrum of HD 209458 b. We calculate the transit depth per wavelength channel with an average relative uncertainty of 40 ppm. We interpret the final spectrum with T-Rex, our fully Bayesian spectral retrieval code, which confirms the presence of water vapor and clouds in the atmosphere of HD 209458 b. The narrow wavelength range limits our ability to disentangle the degeneracies between the fitted atmospheric parameters. Additional data over a broader spectral range are needed to address this issue.