To make full use of the photocathode material and improve its quantum efficiency lifetime, it can be necessary to operate the laser away from the cathode center in photoinjectors. In RF guns, the off-axis emitted beam will see a time-dependent RF effect, which would generate a significant growth in transverse emittance. It has been demonstrated that such an emittance growth can be almost completely compensated by orienting the beam on a proper orbit in the downstream RF cavities along the injector [1]. In this paper we analyze in detail the simulation techniques used in reference [1] and the issues associated with them. The optimization of photoinjector systems involving off-axis beams is a challenging problem. To solve this problem, one needs advanced simulation tools including both genetic algorithms and an efficient algorithm for 3D space charge. In this paper, we report on simulation studies where the two codes ASTRA and IMPACT-T are used jointly to overcome these challenges, in order to optimize a system designed to compensate for the emittance growth in a beam emitted off axis.