Elastoresistivity as a probe of electronically driven rotational symmetry breaking and its application to the hidden order state in URu2Si2