York City FC sealed their promotion to League Two after a dramatic 103rd-minute equaliser in a 1-1 draw with Rochdale.