How to get the same rectangle-shaped scanning shape regardless of orientation

It’s kind of hard to explain but I am making an NPC that scans a certain area using raycast. I’m not sure what is going on here but when it is pointing completely in the direction of one axis it makes a perfect rectangle shape but when I rotate it the shape is distorted. I have a video:

Here is how I did the scanning:


local function rotateVector(v, angle, axis)
	local radians = math.rad(angle)
	local rotationCFrame = CFrame.fromAxisAngle(axis, radians)
	return rotationCFrame:VectorToWorldSpace(v)
end

for i = 0, 70, 1 do
		
		for k = 1, 20 ,1 do
			local newDirection = rotateVector(mainDirection,35 - i,Vector3.new(0,1,0))
			newDirection = rotateVector(newDirection,10-k,Vector3.new(1,0,0))

			local raycast = workspace:Raycast(character.LookPart.Position,newDirection * 1000)

			if raycast then
				
				local dot = SS.Dot:Clone()
				dot.Position = raycast.Position
				dot.Parent = workspace.Testing
				
				local newBeam = LidarBeamTemplate:Clone()
				
				newBeam.Attachment1 = dot.Attachment
				newBeam.Parent = dot

				DebrisService:AddItem(dot,1)
			end
			
		end
		RS.Heartbeat:Wait()
	end

I’m not sure how to fix this, could anyone help me? I am not familiar with vectoring.