Four men who threw a pig's head into the grounds of a mosque two days after the murder of Fusilier Lee Rigby have been jailed.