You are using swept AABB, that's design for point vs rectangle collision, but your current code takes circle vs rectangle you can fix this by using circle vs rectangle swept logic with checks the distance to corner