You can't just "flip velocity over y". To further that point, its obvious to see on the left and right sides of the box you would not flip over y, but instead flip over x.
On the corners you need to flip over a diagonal direction. This is where it becomes less obvious how to flip it. But it's still quite easy:
What you need is a function to flip over any direction. This is often referred to as a reflect function. This direction we call the normal, n.
On the top: n = (1, 0)
On the bottom: n = (-1, 0)
On the left: n = (-1, 0)
On the right: n = (1, 0)
On the corners: n = normalize(circle center - corner), this is the direction between the center of the circle and corner of the box, you must determine which corner to use
Now you have n. Here's how to reflect velocity over n:
reflect(vec2 vec, vec2 n)
// First project vec onto n, this gives the length of vec along the n axis
float nLength = dot(vec, n)
// Lets get that as a vector along n
vec2 vecN = nLength * n
// Now we want to know how much of vec is going along tan/perpendicular to n, easy, just remove vecN from vec
vec2 vecTan = vec - vecN
// These two should sum together such that vec = vecN + vecTan, but we actually want to flip the tangent/perpendicular part of vec, so negate
vec2 results = vecN - vecTan
return results