State-selected charge-transfer and rearrangement reactions in four-atom ion–molecule systems