Some quick googling turned up http://www.scottish.parliament.uk/business/research/pdf_res_notes/rn01-46.pdf, apparently a background briefing for the Scottish Parliament, which says in part:
 Rape is a gender-specific crime. In Scotland, it can only be committed by males upon females, which appears to mean by persons biologically male at birth upon persons born biologically female. It is, therefore, a crime of specific personal violence perpetrated on females. [...] The act of rape must consist of penetration of the victim's vagina by the accused's penis.
 Rather unbelievably, it appears from other googling that Scotland does not even have a written-down criminal code, so it is difficulut to settle this question with sources as authoritative as would be possible in the rest of the world. (By the way, where is the link from the main article to laws about rape?) –