Theory of near-resonant charge exchange in atom-molecule collisions. Dissociative NRCE in the H2+ + Mg collision