Does changing department affect my rank?
When you receive your job offer, it will offer you a specific position/rank. It would be unusual to offer someone a lower rank than they already have, but not inconceivable when moving between universities (i.e. moving from Northern State University to Harvard). It would be very unusual for a department within your university to offer you in effect a demotion.
You would always have the choice to not accept.