A 16-year-old boy who was arrested outside a mosque has been charged with terrorism offences, Police Scotland said.