unity – Make enemy move diagonally in 2D

I’m making the enemy follow the player only straight or diagonally e.g.(1,1)(1,0)(0,1)(-1,1).
I expected the problem that I have, but I don’t really know how to fix it. When my enemy is placed diagonally (relative to the player but not exactly), It will alternate rapidly between going diagonally and straight, causing it to appear like its vibrating.

enter image description here

here is the simple script returning the Vector2 to follow:

        Vector2 direction = (player.position - goblinTr.position).normalized;
        direction.x = Mathf.Round(direction.x);
        direction.y = Mathf.Round(direction.y);

        return direction;