I would solve this by visualizing a triangle that is created between your Frame and the current mouse AbsolutePosition. We can then use the inverse tangent of that triangle's X and Y sides to return the angle at which we need to rotate our Frame.
local Frame = script.Parent
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local RunService = game:GetService('RunService')
RunService.RenderStepped:Connect(function() -- Binded to the client's frames to prevent stuttering
local MousePosX = Mouse.X -- Mouse's X position
local MousePosY = Mouse.Y -- Mouse's Y position
local FrameX = Frame.AbsolutePosition.X -- UIObject's X position
local FrameY = Frame.AbsolutePosition.Y -- UIObject's Y position
local DifX = MousePosX - FrameX -- Base of our triangle
local DifY = MousePosY - FrameY -- Height of our triangle
local Angle = math.deg(math.atan(DifY/DifX)) -- Inverse tangent of height over base, converted to degrees
Frame.Rotation = Angle -- Rotate frame to match calculated angle
end)