https://www.sageadvice.eu/does-an-attack-of-opportunity-occur-when-moving-from-a-square-within-a-hostiles-reach/
Does an Attack of Opportunity occur when moving from a square within a hostile's reach?