factor out rewriting for matchers_division

These mods give about a 10% decrease in run time:

now

>>> timeit('d=Dummy();trigsimp(cos(d)**4/sin(d)**4)','from sympy import sin,cos,Dummy,trigsimp',number=100)
3.9

previously

>>> timeit('d=Dummy();trigsimp(cos(d)**4/sin(d)**4)','from sympy import sin,cos,Dummy,trigsimp',number=100)
4.3